﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

namespace BuildYahooURI.Web
{
    public partial class GetPriceHistory : System.Web.UI.Page
    {

        HelperFunctions hlp = new HelperFunctions();

        protected void Page_Load(object sender, EventArgs e)
        {
            string strTicker, strStartDate, strEndDate;
            if (Request.Params["ticker"] != null)
                strTicker = Request.Params["ticker"].ToString();
            else
                strTicker = "MSFT";

            if (Request.Params["startdate"] != null)
                strStartDate = Request.Params["startdate"].ToString();
            else
                strStartDate = "1-1-2008";
            
            if (Request.Params["enddate"] != null)
                strEndDate = Request.Params["enddate"].ToString();
            else
                strEndDate = "1-1-2009";
            
            XmlDocument xReturn = hlp.getXML(strTicker, strStartDate, strEndDate);
            Response.ContentType = "text/xml";
            Response.Write(xReturn.OuterXml);
        }
    }
}